#include <vector>

class Solution {
public:
    std::vector<int> productExceptSelf(std::vector<int> &nums) {
        std::vector<int> output;
        int tmp = 1;
        for (auto val : nums) {
            output.push_back(tmp);
            tmp *= val;
        }
        tmp = 1;
        for (int i = nums.size() - 1; i >= 0; --i) {
            output[i] *= tmp;
            tmp *= nums[i];
        }
        return output;
    }
};

int main() {
    Solution s;
    std::vector v{1, 2, 3, 4, 5};
}